package com.firewolf.controller;

import com.firewolf.bean.User;
import com.firewolf.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * 作者：刘兴
 * 时间:18/11/28
 **/
@Controller
@RequestMapping("user")
public class UserController {

    @Autowired
    private UserService userService;

    @RequestMapping
    @ResponseBody
    public User addUser(){
        User u = new User();
        u.setName("刘兴");
        u.setAge(20);
        userService.saveUser(u);
        return u;
    }
}
